package ClassificationAlgorithm;

import java.util.ArrayList;

import Definitions.GraphClass;
import Global.ConstantVariable;
import Global.GlobalClass;
import InputPreparer.InputPreparationMethodInterface;
import InputPreparer.InputPreparerTestClass;
import LocalClassifier.LocalClassifierInterface;
import LocalClassifier.LocalClassifierTest;
import Sampling.SamplingAbstractClass;


public class CollectiveClassificationAlgorithmFactory {
	GraphClass graph;
	GlobalClass global;

	public CollectiveClassificationAlgorithmFactory(GraphClass graph, GlobalClass global) 
	{
		this.graph = graph;
		this.global = global;
	}


	public CollectiveClassificationAlgorithmClass createCCA(String CCA_Name, String localClassifierName, SamplingAbstractClass sampling)
	{
		/*get content input*/
		LocalClassifierInterface classifier=null;
		InputPreparerTestClass InputPreparerTest = new InputPreparerTestClass(sampling, global);
		ArrayList<InputPreparationMethodInterface> inputPreparerList= InputPreparerTest.createDummyInputPreparer(CCA_Name);
		
		if(CCA_Name != ConstantVariable.CCA_ConstantVariables.CO_TRAIN)
		{
			classifier = LocalClassifierTest.createDummyClassifier(localClassifierName, inputPreparerList, sampling, global);
		}
		
		if(CCA_Name == ConstantVariable.CCA_ConstantVariables.ICA)
			return new ICAClass(graph, global,classifier, CCA_Name);
	
		if(CCA_Name == ConstantVariable.CCA_ConstantVariables.CONTENT_ONLY)
			return new ContentOnlyClass(graph, global, classifier, CCA_Name);
		
		if(CCA_Name == ConstantVariable.CCA_ConstantVariables.LINK_ONLY)
			return new LinkOnlyClass(graph, global, classifier, CCA_Name);
				
		if(CCA_Name == ConstantVariable.CCA_ConstantVariables.GIBBS)
			return null;
		
		if(CCA_Name == ConstantVariable.CCA_ConstantVariables.CO_TRAIN)
		{
			System.out.println("CO_TRAIN INITIALIZE");
			CCAClass coTrain = new CoTrainAlgorithmClass(graph, global);
			coTrain.initialize();
			return coTrain;
		}
		else return null;
		
	}
}
